package org.apache.maven.plugins.mergeproperties;

import java.io.File;

import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;

/**
 * Represent a merge. 
 * 
 *
 */
public class Merge {

	
	/**
	 * The properties folder file.
	 * 
	 * @parameter 
	 * @required
	 */
	private File propertiesFolder;

	
	/**
	 * The target file.
	 * @parameter
	 * @required
	 * 
	 */
	private File targetFile;


	/**
	 * list of check to done on each values in properties file
	 * @parameter
	 */
	private CheckRegExp[] checks;
	
	

	
	
	public void checkAllPattern(Log log, String fileName, String key, String valueToCheck) throws MojoFailureException{
		if (checks != null && checks.length > 0){
			
			for (CheckRegExp check : checks){
			    check.checkValue(log, fileName, key, valueToCheck);
			}			
		}
	}
	
	
	
	public File getPropertiesFolder() {
		return propertiesFolder;
	}


	public void setPropertiesFolder(File propertiesFolder) {
		this.propertiesFolder = propertiesFolder;
	}


	public File getTargetFile() {
		return targetFile;
	}


	public void setTargetFile(File targetFile) {
		this.targetFile = targetFile;
	}


	public CheckRegExp[] getChecks() {
		return checks;
	}


	public void setChecks(CheckRegExp[] checks) {
		this.checks = checks;
	}


	

	
}
